#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QImage>

const int iTileSize = 20;
const int iEmptyTile = 2;
const int iLevelX = 32;
const int iLevelY = 19;
const int iTilesPerLevel = iLevelX * iLevelY;
const int iBytesPerLevel = 0x333;
const int iFileSize = 82719;
const int iMaxLevel = 101;
const int iDoorTile = 257;
const int iBoard1Tile = 258;
const int iBoard2Tile = 259;
const int iBoard3Tile = 260;
const int iBoard4Tile = 261;
const int iBoard5Tile = 262;
const QString sLevelFile = "robo.lev";
const QString sTilePath = "Tiles";

const int iDoorOffset = 0x263;
const int iBoardOffset = 0x26B;
const int iBoardSize = 40;
const int iMaxBoards = 5;
const int iLevelColourOffset = 0x261;

struct QRoboBoard
{
    int iType;
    int iTile;
    int iPosX;
    int iPosY;
    int iPosXPixel;
    int iPosYPixel;
    int iWidth;
    int iWidthPixel;
    int iDelay;
    int iStop;
    int iDist;
    int iDistPixel;
    int iRev;
    bool bExists;
};

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    char robolev[iFileSize];
    QPixmap Tiles[266];
    Ui::MainWindow *ui;
    int iItemIndexToTile[266];

private:
    QStringList Names;
    void ChangeLevel(int iLevel);
    void LoadAllTiles();
    void onSizeChanged(int Index, int iBoard);
    void onTypeChanged(int Index, int iBoard, int iDist);
    void onDistChanged(int Value, int iBoard, int iType);
    void onDelayChanged(int Value, int iBoard);
    void onRevChanged(bool Checked, int iBoard);
    void onStopChanged(int Index, int iBoard);

private slots:
    void on_btnResetLvl_clicked();
    void on_spinBox_valueChanged(int );
    void on_btnSaveFile_clicked();
    void on_btnColours_clicked();
    void on_ckbExit_clicked();
    void on_ckbBoards_clicked();
    void on_ckbColours_clicked();
    void on_ckbB1Rev_toggled(bool bChecked);
    void on_ckbB2Rev_toggled(bool bChecked);
    void on_ckbB3Rev_toggled(bool bChecked);
    void on_ckbB4Rev_toggled(bool bChecked);
    void on_ckbB5Rev_toggled(bool bChecked);
    void on_cmbB1Size_currentIndexChanged(int i);
    void on_cmbB2Size_currentIndexChanged(int i);
    void on_cmbB3Size_currentIndexChanged(int i);
    void on_cmbB4Size_currentIndexChanged(int i);
    void on_cmbB5Size_currentIndexChanged(int i);
    void on_cmbB1Type_currentIndexChanged(int i);
    void on_cmbB2Type_currentIndexChanged(int i);
    void on_cmbB3Type_currentIndexChanged(int i);
    void on_cmbB4Type_currentIndexChanged(int i);
    void on_cmbB5Type_currentIndexChanged(int i);
    void on_cmbB1Stop_currentIndexChanged(int i);
    void on_cmbB2Stop_currentIndexChanged(int i);
    void on_cmbB3Stop_currentIndexChanged(int i);
    void on_cmbB4Stop_currentIndexChanged(int i);
    void on_cmbB5Stop_currentIndexChanged(int i);
    void on_spnB1Dist_valueChanged(int i);
    void on_spnB2Dist_valueChanged(int i);
    void on_spnB3Dist_valueChanged(int i);
    void on_spnB4Dist_valueChanged(int i);
    void on_spnB5Dist_valueChanged(int i);
    void on_spnB1Delay_valueChanged(int i);
    void on_spnB2Delay_valueChanged(int i);
    void on_spnB3Delay_valueChanged(int i);
    void on_spnB4Delay_valueChanged(int i);
    void on_spnB5Delay_valueChanged(int i);
    void on_btnB1Del_clicked();
    void on_btnB2Del_clicked();
    void on_btnB3Del_clicked();
    void on_btnB4Del_clicked();
    void on_btnB5Del_clicked();
};

#endif // MAINWINDOW_H
